import 'dart:convert' show json;

class VideoType {
  int code;
  String message;
  ResultType result;

  VideoType.fromParams({this.code, this.message, this.result});

  factory VideoType(jsonStr) => jsonStr == null
      ? null
      : jsonStr is String
          ? new VideoType.fromJson(json.decode(jsonStr))
          : new VideoType.fromJson(jsonStr);

  VideoType.fromJson(jsonRes) {
    code = jsonRes['code'];
    message = jsonRes['message'];
    result = jsonRes['result'] == null
        ? null
        : new ResultType.fromJson(jsonRes['result']);
  }

  @override
  String toString() {
    return '{"code": $code,"message": ${message != null ? '${json.encode(message)}' : 'null'},"result": $result}';
  }
}

class ResultType {
  String nextPageUrl;
  int count;
  int total;
  bool adExist;
  List<TypeItem> itemList;

  ResultType.fromParams(
      {this.nextPageUrl, this.count, this.total, this.adExist, this.itemList});

  ResultType.fromJson(jsonRes) {
    nextPageUrl = jsonRes['nextPageUrl'];
    count = jsonRes['count'];
    total = jsonRes['total'];
    adExist = jsonRes['adExist'];
    itemList = jsonRes['itemList'] == null ? null : [];

    for (var itemListItem in itemList == null ? [] : jsonRes['itemList']) {
      itemList.add(
          itemListItem == null ? null : new TypeItem.fromJson(itemListItem));
    }
  }

  @override
  String toString() {
    return '{"nextPageUrl": ${nextPageUrl != null ? '${json.encode(nextPageUrl)}' : 'null'},"count": $count,"total": $total,"adExist": $adExist,"itemList": $itemList}';
  }
}

class TypeItem {
  String tag;
  int adIndex;
  int id;
  String type;
  Data data;

  TypeItem.fromParams({this.tag, this.adIndex, this.id, this.type, this.data});

  TypeItem.fromJson(jsonRes) {
    tag = jsonRes['tag'];
    adIndex = jsonRes['adIndex'];
    id = jsonRes['id'];
    type = jsonRes['type'];
    data = jsonRes['data'] == null ? null : new Data.fromJson(jsonRes['data']);
  }

  @override
  String toString() {
    return '{"tag": ${tag != null ? '${json.encode(tag)}' : 'null'},"adIndex": $adIndex,"id": $id,"type": ${type != null ? '${json.encode(type)}' : 'null'},"data": $data}';
  }
}

class Data {
  String adTrack;
  String subTitle;
  int id;
  bool expert;
  bool ifPgc;
  String actionUrl;
  String dataType;
  String description;
  String icon;
  String iconType;
  String title;
  Follow follow;

  Data.fromParams(
      {this.adTrack,
      this.subTitle,
      this.id,
      this.expert,
      this.ifPgc,
      this.actionUrl,
      this.dataType,
      this.description,
      this.icon,
      this.iconType,
      this.title,
      this.follow});

  Data.fromJson(jsonRes) {
    adTrack = jsonRes['adTrack'];
    subTitle = jsonRes['subTitle'];
    id = jsonRes['id'];
    expert = jsonRes['expert'];
    ifPgc = jsonRes['ifPgc'];
    actionUrl = jsonRes['actionUrl'];
    dataType = jsonRes['dataType'];
    description = jsonRes['description'];
    icon = jsonRes['icon'];
    iconType = jsonRes['iconType'];
    title = jsonRes['title'];
    follow = jsonRes['follow'] == null
        ? null
        : new Follow.fromJson(jsonRes['follow']);
  }

  @override
  String toString() {
    return '{"adTrack": ${adTrack != null ? '${json.encode(adTrack)}' : 'null'},"subTitle": ${subTitle != null ? '${json.encode(subTitle)}' : 'null'},"id": $id,"expert": $expert,"ifPgc": $ifPgc,"actionUrl": ${actionUrl != null ? '${json.encode(actionUrl)}' : 'null'},"dataType": ${dataType != null ? '${json.encode(dataType)}' : 'null'},"description": ${description != null ? '${json.encode(description)}' : 'null'},"icon": ${icon != null ? '${json.encode(icon)}' : 'null'},"iconType": ${iconType != null ? '${json.encode(iconType)}' : 'null'},"title": ${title != null ? '${json.encode(title)}' : 'null'},"follow": $follow}';
  }
}

class Follow {
  int itemId;
  bool followed;
  String itemType;

  Follow.fromParams({this.itemId, this.followed, this.itemType});

  Follow.fromJson(jsonRes) {
    itemId = jsonRes['itemId'];
    followed = jsonRes['followed'];
    itemType = jsonRes['itemType'];
  }

  @override
  String toString() {
    return '{"itemId": $itemId,"followed": $followed,"itemType": ${itemType != null ? '${json.encode(itemType)}' : 'null'}}';
  }
}
